home *** CD-ROM | disk | FTP | other *** search
- Frequently Asked Questions (FAQS);faqs.220
-
-
- Section 11. Stdio
-
- 11.1: Why doesn't the code "char c; while((c = getchar()) != EOF)..."
- work?
-
- A: The variable to hold getchar's return value must be an int.
-
- 11.2: Why does errno contain ENOTTY after a call to printf?
-
- A: Don't worry about it. It is only meaningful for a program to
- inspect the contents of errno after an error has occurred.
-
- 11.3: My program's prompts and intermediate output don't always show
- up on the screen, especially when I pipe the output through
- another program.
-
- A: It is best to use an explicit fflush(stdout) whenever output
- should definitely be visible.
-
- 11.4: When I read from the keyboard with scanf, it seems to hang until
- I type one extra line of input.
-
- A: scanf was designed for free-format input, which is seldom what
- you want when reading from the keyboard.
-
- 11.5: Will fflush(stdin) flush unread characters from the standard
- input stream?
-
- A: No.
-
- 11.6: Once I've used freopen, how can I get the original stdout back?
-
- A: It's not easy. Try avoiding freopen.
-
- 11.7: How can I recover the file name given an open file descriptor?
-
- A: This problem is, in general, insoluble. It is best to remember
- the names of files yourself when you open them.
-
-
- Section 12. Library Subroutines
-
- 12.1: I'm trying to sort an array of strings with qsort, using strcmp
- as the comparison function, but it's not working.
-
- A: You'll have to write a "helper" comparison function which takes
- two generic pointer arguments, converts them to char **, and
- dereferences them, yielding char *'s which can be usefully
- compared.
-
- 12.2: Now I'm trying to sort an array of structures with qsort. My
- comparison routine takes pointers to structures, but the
- compiler complains that the function is of the wrong type for
- qsort. How can I cast the function pointer to shut off the
- warning?
-
- A: The conversions must be in the comparison function, which must
- be declared as accepting "generic pointers" (void * or char *).
-
- 12.3: How can I convert numbers to strings?
-
- A: Just use sprintf.
-
- 12.4: How can I get the time of day in a C program?
-
- A: Just use the time, ctime, and/or localtime functions.
-
- 12.5: How can I convert a struct tm or a string into a time_t?
-
- A: The ANSI mktime routine converts a struct tm to a time_t.
- No standard routine exists to parse strings.
-
- 12.6: I need a random number generator.
-
- A: The standard C library has one: rand().
-
- 12.7: Each time I run my program, I get the same sequence of random
- numbers.
-
- A: You can call srand() to seed the pseudo-random number generator
- with a more random initial value.
-
- 12.8: I need a random true/false value, so I'm taking rand() % 2, but
- it's just alternating 0, 1, 0, 1, 0...
-
- A: Try using the higher-order bits.
-
- 12.9-13: I'm trying to port this old program. Why do I get "undefined
- external" errors for some library routines?
-
- A: Some semistandard routines have been renamed or replaced over
- the years; see the full list for details.
-
- 12.14: How can I execute a command with system() and read its output
- into a program?
-
- A: Unix and some other systems provide a popen() routine.
-
- 12.15: How can I read a directory in a C program?
-
- A: See if you can use the opendir() and readdir() routines.
-
-
- Section 13. Lint
-
- 13.1: I just typed in this program, and it's acting strangely.
- Can you see anything wrong with it?
-
- A: Try running lint first.
-
- 13.2: How can I shut off the "warning: possible pointer alignment
- problem" message lint gives me for each call to malloc?
-
- A: It may be easier simply to ignore the message, perhaps in an
- automated way with grep -v.
-
- 13.3: Where can I get an ANSI-compatible lint?
-
- A: See the unabridged list for two commercial products.
-
-
- Section 14. Style
-
- 14.1: Is the code "if(!strcmp(s1, s2))" good style?
-
- A: Perhaps; perhaps not.
-
- 14.2: What's the best style for code layout in C?
-
- A: There is no one "best style," but see the full list for a few
- suggestions.
-
- 14.3: Where can I get the "Indian Hill Style Guide" and other coding
- standards?
-
- A: See the unabridged list.
-
-
- Section 15. Floating Point
-
- 15.1: My floating-point calculations are acting strangely and giving
- me different answers on different machines.
-
- A: First, make sure that you have #included <math.h>, and correctly
- declared other functions returning double. If the problem isn't
- that simple, see the full list for a brief explanation, or any
- good programming book for a better one.
-
- 15.2: I keep getting "undefined: _sin" compilation errors.
-
- A: Make sure you're linking against the correct math library.
-
- 15.3: Why doesn't C have an exponentiation operator?
-
- A: Try using the pow() function.
-
- 15.4: I'm having trouble with a Turbo C program which crashes and says
- something like "floating point formats not linked."
-
- A: Some compilers for small machines, including Turbo C, attempt to
- leave out floating point support if it looks like it will not be
- needed. The programmer must occasionally insert a dummy
- explicit floating-point call to force loading of floating-point
- support.
-
-
- Section 16. System Dependencies
-
- 16.1: How can I read a single character from the keyboard without
- waiting for a newline?
-
- A: Contrary to popular belief and many people's wishes, this is not
- a C-related question. How to do so is a function of the
- operating system in use.
-
- 16.2: How can I find out if there are characters available for reading
- (and if so, how many)? Alternatively, how can I do a read that
- will not block if there are no characters available?
-
- A: These, too, are entirely operating-system-specific.
-
- 16.3: How can I clear the screen?
-
- A: Such things depend on the output device you're using.
-
- 16.4: How do I read the mouse?
-
- A: What system are you using?
-
- 16.5: How can my program discover the complete pathname to the
- executable file from which it was invoked?
-
- A: argv[0] may contain all or part of the pathname. You may be
- able to duplicate the command language interpreter's search path
- logic to locate the executable.
-
- 16.6: How can a process change an environment variable in its caller?
-
- A: In general, it cannot.
-
- 16.7: How can I find out the size of a file, prior to reading it in?
-
- A: You might be able to get an estimate using stat() or
- fseek/ftell.
-
- 16.8: How can a file be shortened in-place without completely clearing
- or rewriting it?
-
- A: There are various ways to do this, but there is no truly
- portable solution.
-
- 16.9: How can I implement a delay, or time a user's response, with
- sub-second resolution?
-
- A: Unfortunately, there is no portable way.
-
- 16.10: How can I read in an object file and jump to routines in it?
-
- A: You want a dynamic linker and/or loader.
-
-
- Section 17. Miscellaneous
-
- 17.1: What can I safely assume about the initial values of variables
- which are not explicitly initialized?
-
- A: Variables with "static" duration start out as 0, as if the
- programmer had initialized them. Variables with "automatic"
- duration, and dynamically-allocated memory, start out containing
- garbage (with the exception of calloc).
-
- 17.2: How can I write data files which can be read on other machines
- with different data formats?
-
- A: The best solution is to use text files.
-
- 17.3: How can I return several values from a function?
-
- A: Either pass pointers to locations which the function can fill
- in, or have the function return a structure containing the
- desired values.
-
- 17.4: How can I call a function, given its name as a string?
-
- A: The most straightforward thing to do is maintain a
- correspondence table of names and function pointers.
-
- 17.5: I seem to be missing the system header file <sgtty.h>.
- Can someone send me a copy?
-
- A: You cannot just pick up a copy of someone else's header file and
- expect it to work, since the definitions within header files are
- frequently system-dependent. Contact your vendor.
-
- 17.6: How can I call FORTRAN (C++, BASIC, Pascal, Ada, LISP) functions
- from C?
-
- A: The answer is entirely dependent on the machine and the specific
- calling sequences of the various compilers in use.
-
- 17.7: Does anyone know of a program for converting Pascal or FORTRAN
- to C?
-
- A: Several public-domain programs are available, namely ptoc, p2c,
- and f2c. See the full list for details.
-
- 17.8: Where can I get copies of all these public-domain programs?
-
- A: See the regular postings in the comp.sources.unix and
- comp.sources.misc newsgroups for information.
-
- 17.9: When will the next Obfuscated C Code Contest be held
- How can I get a copy of the previous winning entries?
-
- A: See the full list, or send e-mail to obfuscate@toad.com .
-
- 17.10: Why don't C comments nest? Are they legal inside quoted
- strings?
-
- A: Nested comments would cause more harm than good. The character
- sequences /* and */ are not special within double-quoted
- strings.
-
- 17.11: How can I implement sets and/or arrays of bits?
-
- A: Use arrays of char or int, with a few macros to access the right
- bit at the right index.
-
- 17.12: What is the most efficient way to count the number of bits which
- are set in a value?
-
- A: This and many other similar bit-twiddling problems can often be
- sped up and streamlined using lookup tables.
-
- 17.13: How can I make this code more efficient?
-
- A: Efficiency is not important nearly as often as people tend to
- think it is. Most of the time, by simply paying attention to
- good algorithm choices, perfectly acceptable results can be
- achieved.
-
- 17.14: Are pointers really faster than arrays? How much do function
- calls slow things down?
-
- A: Precise answers to these and many similar questions depend of
- course on the processor and compiler in use.
-
- 17.15: This program crashes before it even runs!
-
- A: Look for very large, local arrays.
- (See also question 9.4.)
-
- 17.16: What does "Segmentation violation" mean?
-
- A: It generally means that your program tried to access memory it
- shouldn't have.
-
- 17.17: Does anyone have a C compiler test suite I can use?
-
- A: Plum Hall, among others, sells one.
-
- 17.18: Where can I get a YACC grammar for C?
-
- A: See the ANSI Standard, or the unabridged list.
-
- 17.19: How do you pronounce "char"?
-
- A: Like the English words "char," "care," or "car" (your choice).
-
- 17.20: What's a good book for learning C?
-
- A: There are far too many to list here; the full list contains a
- few pointers.
-
- 17.21: Where can I get extra copies of this list?
-
- A: For now, just pull it off the net; the unabridged version is
- normally posted on the first of each month, with an Expiration:
- line which should keep it around all month. It can also be
- found in the newsgroup news.answers . Several sites archive
- news.answers postings and other FAQ lists, including this one;
- the archie server should help you find them.
-
-
- Steve Summit
- scs@adam.mit.edu
- scs%adam.mit.edu@mit.edu
- mit-eddie!adam.mit.edu!scs
-
- This article is Copyright 1988, 1990-1992 by Steve Summit.
- It may be freely redistributed so long as the author's name, and this
- notice, are retained.
- Xref: bloom-picayune.mit.edu comp.lang.c:59948 news.answers:3846
- Newsgroups: comp.lang.c,news.answers
- Path: bloom-picayune.mit.edu!adam.mit.edu!scs
- From: scs@adam.mit.edu (Steve Summit)
- Subject: comp.lang.c Changes to Answers to Frequently Asked Questions (FAQ)
- Message-ID: <1992Nov3.010510.14974@athena.mit.edu>
- Followup-To: poster
- Sender: news@athena.mit.edu (News system)
- Supersedes: <1992Oct1.210814.22950@athena.mit.edu>
- Nntp-Posting-Host: adam.mit.edu
- Reply-To: scs@adam.mit.edu
- X-Archive-Name: C-faq/diff
- Organization: none, at the moment
- Date: Tue, 3 Nov 1992 01:05:10 GMT
- Approved: news-answers-request@MIT.Edu
- Lines: 340
-
- Archive-name: C-faq/diff
-
- This article contains changes between the previous revision of
- the comp.lang.c frequently-asked questions list (posted on
- October 1) and the new one. (Do _not_ worry if you have not seen
- the new one yet; it's coming up next.) As usual, these diffs
- have been edited for readability, and are not suitable for use
- with the patch program.
-
- The changes this month are mostly minor and/or cosmetic. The
- only mildly significant and/or interesting one is that I had
- somehow managed to add the same question twice (what had been 2.5
- and 2.6); thanks to Mark Brader for pointing this out.
-
- ==========
- < [Last modified October 1, 1992 by scs.]
- ---
- > [Last modified November 2, 1992 by scs.]
- ==========
- pointer arguments. To generate a null pointer in a function
- < call context, an explicit cast is typically required:
- ---
- > call context, an explicit cast is typically required, to force
- > the 0 to be in a pointer context:
- ==========
- 6. The "null string," which is another name for an empty
- < string. The term "null string" can be confusing in C
- ---
- > string (""). The term "null string" can be confusing in
- ==========
- < (The exceptions are when the array is the operand of a sizeof()
- < or & operator, or is a literal string initializer for a
- ---
- > (The exceptions are when the array is the operand of a sizeof or
- > & operator, or is a literal string initializer for a character
- ==========
- A: Since arrays decay immediately into pointers, an array is never
- < actually passed to a function. Therefore, any parameter
- ---
- > actually passed to a function. As a convenience, any parameter
- ==========
- < 2.5: Why doesn't sizeof() properly report the size of an array that's
- < a parameter to a subroutine?
- <
- < A: sizeof() reports the size of the pointer parameter which the
- < subroutine really receives (see question 2.4).
- <
- < 2.6: Why doesn't sizeof(array) work when the array is a function
- < parameter?
- <
- < A: The compiler pretends that the array parameter was declared as a
- < pointer (see question 2.4), and sizeof reports the size of the
- < pointer.
- ---
- > 2.5: Why doesn't sizeof properly report the size of an array which is
- > a parameter to a function?
- >
- > A: The sizeof operator reports the size of the pointer parameter
- > which the function actually receives (see question 2.4).
- ==========
- no longer needed. You must also be extremely cautious when
- < passing dynamically-allocated arrays down to other subroutines,
- < if those subroutines are also to accept conventional,
- ---
- > passing dynamically-allocated arrays down to other functions, if
- > those functions are also to accept conventional, statically-
- ==========
- < 2.13: I passed a pointer to a subroutine which initialized it:
- ---
- > 2.12: I passed a pointer to a function which initialized it:
- ==========
- static int dummy;
- < ip = &i;
- ---
- > ip = &dummy;
- ==========
- < A: Did the subroutine try to initialize the pointer itself, or just
- ---
- > A: Did the function try to initialize the pointer itself, or just
- ==========
- < value. The called subroutine altered only the passed copy of
- < the pointer. You'll want to pass the address of the pointer
- < (the subroutine will end up accepting a pointer-to-a-pointer).
- ---
- > value. The called function altered only the passed copy of the
- > pointer. You'll want to pass the address of the pointer (the
- > function will end up accepting a pointer-to-a-pointer).
- ==========
- < 3.4: I have a function that returns a string, and it seems to work
- < fine under the debugger, but when it returns to its caller, the
- < returned string is garbage.
- ---
- > 3.4: I have a function that is supposed to return a string, but when
- > it returns to its caller, the returned string is garbage.
- ==========
- A: Under C's integral promotion rules, the multiplication is
- < carried out using integer arithmetic, and the result overflows
- < and/or is truncated before being assigned to the long int left-
- ---
- > carried out using int arithmetic, and the result may overflow
- > and/or be truncated before being assigned to the long int left-
- ==========
- "int func(x) float x;". Old C (and ANSI C, in the absence of
- < prototypes) silently promotes floats to doubles when passing
- < them as arguments, and arranges that doubles being passed are
- < coerced back to floats if the formal parameters are declared
- < that way.
- ---
- > prototypes, and in variable-length argument lists) "widens"
- > certain arguments when they are passed to functions. floats
- > are promoted to double, and characters and short integers are
- > promoted to integers. (The values are automatically coerced
- > back to the corresponding narrower types within the body of the
- > called function, if they are declared that way there.)
- ==========
- < rely on such an extension? It is usually a bad idea to try to
- < determine language properties, especially pertaining to the ANSI
- < Standard, by performing experiments with a particular compiler.
- ---
- > rely on such an extension? It is usually a bad idea to perform
- > experiments with a particular compiler to determine properties
- > of a language; the applicable standard may permit variations, or
- > the compiler may be wrong.
- ==========
- A: There is no good answer to this question. If the values are
- integers, a well-known trick using exclusive-OR could perhaps be
- used, but it will not work for floating-point values or
- < pointers, (and it will not work if the two values are the same
- < variable, and the "obvious" supercompressed implementation for
- < integral types a^=b^=a^=b is, strictly speaking, illegal due to
- < multiple side-effects, and...). If the macro is intended to be
- ---
- > pointers, or if the two values are the same variable (and the
- > "obvious" supercompressed implementation for integral types
- > a^=b^=a^=b is in fact illegal due to multiple side-effects,
- > and...). If the macro is intended to be used on values of
- ==========
- The best all-around solution is probably to forget about using a
- < macro, unless you don't mind passing in the type as a third
- ---
- > macro, unless you're willing to pass in the type as a third
- ==========
- < 6.5: Does sizeof() work in preprocessor #if directives?
- ---
- > 6.5: Does the sizeof operator work in preprocessor #if directives?
- ==========
- compilation, before type names have been parsed. Consider using
- < the predefined constants in <limits.h>, or a "configure" script,
- ---
- > the predefined constants in ANSI's <limits.h>, or a "configure"
- ==========
- < #include <stddef.h> /* for NULL, size_t */
- < #include <stdlib.h> /* for malloc */
- ---
- > #include <stdlib.h> /* for malloc, NULL, size_t */
- ==========
- Under a pre-ANSI compiler, rewrite the function definition
- without a prototype ("char *vstrcat(first) char *first; {"),
- < include <stdio.h> rather than <stddef.h>, replace "#include
- < <stdlib.h>" with "extern char *malloc();", and use int instead
- ---
- > include <stdio.h> rather than <stdlib.h>, add "extern
- > char *malloc();", and use int instead of size_t. You may also
- ==========
- > Remember that in variable-length argument lists, function
- > prototypes do not supply parameter type information; therefore,
- > default argument promotions apply (see question 5.6), and null
- > pointer arguments must be typed explicitly (see question 1.2).
- ==========
- < A: Structures may have this padding, so that alignment properties
- < will be preserved when an array of contiguous structures is
- < allocated.
- ---
- > A: Structures may have this padding (as well as internal padding;
- > see also question 9.5), so that alignment properties will be
- > preserved when an array of contiguous structures is allocated.
- ==========
- < 9.10: How can I turn off structure padding, so that I can get a struct
- < to conform to an externally-imposed storage layout?
- ---
- > 9.10: My compiler is leaving holes in structures, which is wasting
- > space and preventing "binary" I/O to external data files. Can I
- > turn off the padding, or otherwise control the alignment of
- > structs?
- ==========
- < attempting to conform to some externally-imposted storage
- ---
- > attempting to conform to some externally-imposed storage layout,
- ==========
- < It is usually better to use fgets() to read a whole line, and
- < then use sscanf() or other string functions to pick apart the
- < line buffer.
- ---
- > It is usually better to use fgets to read a whole line, and
- > then use sscanf or other string functions to pick apart the line
- > buffer. If you do use sscanf, don't forget to check the return
- > value to make sure that the expected number of items were found.
- ==========
- < links). It is best to remember the names of open files yourself
- < (perhaps with a wrapper function around fopen).
- ---
- > links). It is best to remember the names of files yourself when
- > you open them (perhaps with a wrapper function around fopen).
- ==========
- < 12.7: Each time I run my program, I get the same sequence of random
- < numbers.
- ---
- > 12.7: Each time I run my program, I get the same sequence of numbers
- > back from rand().
- ==========
- A: You can call srand() to seed the pseudo-random number generator
- < with a more random value. Popular random initial seeds are the
- ---
- > with a more random initial value. Popular random initial seeds
- ==========
- < A: Try running lint first. Many C compilers are really only half-
- ---
- > A: Try running lint first (perhaps with the -a, -c, -h, -p and/or
- > other options). Many C compilers are really only half-
- ==========
- A: Make sure you're linking against the correct math library. For
- < instance, under Unix, you usually need to add -lm after the
- < source and object files when compiling/linking.
- ---
- > instance, under Unix, you usually need to use the -lm option at
- > the end of the command line when compiling/linking.
- ==========
- A: You can #include <math.h> and use the pow() function, although
- < explicit multiplication is often better for small integral
- < exponents.
- ---
- > explicit multiplication is often better for small positive
- > integral exponents.
- ==========
- A: BSD systems provide ftruncate(), several others supply chsize(),
- and a few may provide a (possibly undocumented) fcntl option
- F_FREESP. Under MS-DOS, you can sometimes use
- < write(fd, (char *)NULL, 0). However, but there is no truly
- < portable solution.
- ---
- > write(fd, "x", 0). However, there is no truly portable
- > solution.
- ==========
- < 17.3: How can I return several values from a subroutine?
- ---
- > 17.3: How can I return several values from a function?
- ==========
- < A: Either pass pointers which the subroutine can fill in, or have
- < the subroutine return a structure containing the desired values.
- ---
- > A: Either pass pointers to locations which the function can fill
- > in, or have the function return a structure containing the
- ==========
- < 17.7: Does anyone know of a program for converting Pascal (FORTRAN,
- < LISP, "Old" C, ...) to C?
- ---
- > 17.7: Does anyone know of a program for converting Pascal or FORTRAN
- > (or LISP, Ada, AWK, "Old" C, ...) to C?
- ==========
- < A PL/M to C converter was posted to alt.sources in April, 1991.
- <
- < The following companies sell various translation tools and
- < services:
- <
- < Cobalt Blue
- < 2940 Union Ave., Suite C
- < San Jose, CA 95124 USA
- < (+1) 408 723 0474
- <
- < Promula Development Corp.
- < 3620 N. High St., Suite 301
- < Columbus, OH 43214 USA
- < (+1) 614 263 5454
- <
- < Micro-Processor Services Inc.
- < 92 Stone Hurst Lane
- < Dix Hills, NY 11746 USA
- < (+1) 519 499 4461
- ---
- > This FAQ list's maintainer also has available a list of other
- > commercial translation products, and some for more obscure
- > languages.
- ==========
- A: The contest typically runs from early March through mid-May. To
- obtain a current copy of the rules and other information, send
- e-mail with the Subject: line "send rules" to:
-
- < {apple,pyramid,sun,uunet}!hoptoad!judges or judges@toad.com
- ---
- > {apple,pyramid,sun,uunet}!hoptoad!obfuscate or
- > obfuscate@toad.com
- ==========
- A: Use arrays of char or int, with a few macros to access the right
- < bit at the right index:
- ---
- > bit at the right index (try using 8 for CHAR_BIT if you don't
- > have <limits.h>):
- ==========
- < #define Mask(bit) (1 << ((bit) % CHAR_BIT))
- < #define Slot(bit) ((bit) / CHAR_BIT)
- < #define Set(ary, bit) ((ary)[Slot(bit)] |= Mask(bit))
- < #define Test(ary, bit) ((ary)[Slot(bit)] & Mask(bit))
- ---
- > #define BITMASK(bit) (1 << ((bit) % CHAR_BIT))
- > #define BITSLOT(bit) ((bit) / CHAR_BIT)
- > #define BITSET(ary, bit) ((ary)[BITSLOT(bit)] |= BITMASK(bit))
- > #define BITTEST(ary, bit) ((ary)[BITSLOT(bit)] & BITMASK(bit))
- ==========
- > 17.19: How do you pronounce "char"?
- >
- > A: You can pronounce the C keyword "char" in at least three ways:
- > like the English words "char," "care," or "car;" the choice is
- > arbitrary.
- ==========
- > Knuth Donald E. Knuth, The Art of Computer Programming, (3 vols.),
- > Addison Wesley, 1981.
- ==========
- Thanks to Jamshid Afshar, Sudheer Apte, Dan Bernstein, Stan Brown, Joe
- Buehler, Burkhard Burow, D'Arcy J.M. Cain, Raymond Chen, Christopher
- Calabrese, James Davies, Norm Diamond, Ray Dunn, Stephen M. Dunn, Bjorn
- Engsig, Dave Gillespie, Samuel Goldstein, Alasdair Grant, Ron Guilmette,
- Doug Gwyn, Tony Hansen, Joe Harrington, Guy Harris, Jos Horsmeier, Blair
- Houghton, Kirk Johnson, Peter Klausler, Andrew Koenig, Tom Koenig, John
- > Lauro, Don Libes, Christopher Lott, Tim McDaniel, Evan Manning, Barry
- > Margolin, Mark Moraes, Darren Morby, Richard A. O'Keefe, Hans Olsson,
- Francois Pinard, randall@virginia, Pat Rankin, Rich Salz, Chip
- Salzenberg, Paul Sand, Doug Schmidt, Patricia Shanahan, Peter da Silva,
- Joshua Simons, Henry Spencer, Erik Talvola, Clarke Thatcher, Chris
- Torek, Goran Uddeborg, Wietse Venema, Ed Vielmetti, Larry Virden, Freek
- Wiedijk, and Dave Wolverton, who have contributed, directly or
- indirectly, to this article. Special thanks to Karl Heuer, and
- particularly to Mark Brader, who (to borrow a line from Steve Johnson)
- have goaded me beyond my inclination, and occasionally beyond my
- endurance, in relentless pursuit of a better FAQ list.
- ==========
-
- Steve Summit
- scs@adam.mit.edu
- scs%adam.mit.edu@mit.edu
- mit-eddie!adam.mit.edu!scs
- Xref: bloom-picayune.mit.edu comp.lang.c:61497 news.answers:4291
- Newsgroups: comp.lang.c,news.answers
- Path: bloom-picayune.mit.edu!adam.mit.edu!scs
- From: scs@adam.mit.edu (Steve Summit)
- Subject: comp.lang.c Answers to Frequently Asked Questions (FAQ List)
- Message-ID: <1992Dec1.025024.25129@athena.mit.edu>
- Followup-To: poster
- Sender: news@athena.mit.edu (News system)
- Supersedes: <1992Nov3.010706.15151@athena.mit.edu>
- Nntp-Posting-Host: adam.mit.edu
- Reply-To: scs@adam.mit.edu
- X-Archive-Name: C-faq/faq
- Organization: none, at the moment
- Date: Tue, 1 Dec 1992 02:50:24 GMT
- X-Last-Modified: November 2, 1992
- Approved: news-answers-request@MIT.Edu
- Expires: Sun, 3 Jan 1993 00:00:00 GMT
- Lines: 2879
-
- Archive-name: C-faq/faq
- Newsgroup-name-archive-name: C-FAQ-list
-
- [Last modified November 2, 1992 by scs.]
-
- Certain topics come up again and again on this newsgroup. They are good
- questions, and the answers may not be immediately obvious, but each time
- they recur, much net bandwidth and reader time is wasted on repetitive
- responses, and on tedious corrections to the incorrect answers which are
- inevitably posted.
-
- This article, which is posted monthly, attempts to answer these common
- questions definitively and succinctly, so that net discussion can move
- on to more constructive topics without continual regression to first
- principles.
-
- No mere newsgroup article can substitute for thoughtful perusal of a
- full-length tutorial or language reference manual. Anyone interested
- enough in C to be following this newsgroup should also be interested
- enough to read and study one or more such manuals, preferably several
- times. Some vendors' compiler manuals are unfortunately inadequate; a
- few even perpetuate some of the myths which this article attempts to
- refute. Several noteworthy books on C are listed in this article's
- bibliography. Many of the questions and answers are cross-referenced to
- these books, for further study by the interested and dedicated reader
- (but beware of ANSI vs. ISO C Standard section numbers; see question
- 5.1).
-
- If you have a question about C which is not answered in this article,
- first try to answer it by checking a few of the referenced books, or by
- asking knowledgeable colleagues, before posing your question to the net
- at large. There are many people on the net who are happy to answer
- questions, but the volume of repetitive answers posted to one question,
- as well as the growing number of questions as the net attracts more
- readers, can become oppressive. If you have questions or comments
- prompted by this article, please reply by mail rather than following up
- -- this article is meant to decrease net traffic, not increase it.
-